import request from "@/utils/request";
import qs from "qs";
export function getAdminList(pageOpts) {
  return request({
    url: `/web/admin/?${qs.stringify(pageOpts)}`,
    method: "get"
  });
}
export function addAdmin(data) {
  return request({
    url: `/web/admin/?${qs.stringify(data)}`,
    method: "post"
  });
}

export function getAccessById(id) {
  return request({
    url: `/web/admin/menuAccess/${id}`,
    method: "get"
  });
}


export function getAdminById(id) {
  return request({
    url: `/web/admin/${id}`,
    method: "get"
  });
}


export function delAdminById(id) {
  return request({
    url: `/web/admin/${id}`,
    method: "delete"
  });
}

export function updateAdminStatus(data) {
  return request({
    url: `/web/admin/status?${qs.stringify(data)}`,
    method: "post"
  });
}

export function restPassword(id) {
  return request({
    url: `/web/admin/resetPassword/${id}`,
    method: "patch"
  });
}


export function updateAdminInfo(id, data) {
  return request({
    url: `/web/admin/${id}?${qs.stringify(data)}`,
    method: "put"
  });
}


export function updateMenu(id, data) {
  return request({
    url: `/web/admin/menuAccess/${id}?${qs.stringify(data)}`,
    method: "patch"
  });
}